/**
 * Created by Lcp on 2018/5/10.
 */
var num = window.location.search.split('=')[1],  //10扫黑除恶成果 11枪暴违法犯罪 12小案打防攻坚战 13起诉率  14重刑率  15拐骗工作起诉率
    obj = {
        legendData: [],
        seriesData: [],
        type: '{c}'
    },//数据
    data = [],
    caseEg = JSON.parse(window.sessionStorage.getItem('data'));
if(num == 10){
    obj.legendData = ['线索','刑拘','破案'];
    obj.seriesData = [
        caseEg.shcexss,
        caseEg.shcexjs,
        caseEg.shcepas
    ];
}
if(num == 11){
    obj.legendData = ['线索','战果'];
    obj.seriesData = [
        caseEg.sqfzxs,
        caseEg.sqfzzg
    ];
}
if(num == 12){
    obj.legendData = ['盗窃破案率','接触性诈骗破案率','电诈破案率'];
    obj.seriesData = [
        caseEg.xadfdqpal,
        caseEg.xadfjcxzppal,
        caseEg.xadfdzpal
    ];
    obj.Type = '{c}%';
}
if(num == 13){
    obj.legendData = ['起诉增长率'];
    obj.seriesData = [
        caseEg.qsl
    ];
    obj.Type = '{c}%';
}
if(num ==14){
    obj.legendData = ['重刑率'];
    obj.seriesData = [
        caseEg.zxl
    ];
    obj.Type = '{c}%';
}
if(num == 15){
    obj.legendData = ['起诉率','撤销案情况'];
    obj.seriesData = [
        caseEg.gpqsl,
        caseEg.gpcxal
    ];
    obj.Type = '{c}%';
}
if(num == 16){ //人脸
    obj.legendData = ['人像'];
    obj.seriesData = [
        caseEg.parls
    ]
}
if(num == 17){ //指纹
    obj.legendData = ['指纹'];
    obj.seriesData = [
        caseEg.pazws
    ]
}
if(num == 18){ //DNA
    obj.legendData = ['DNA'];
    obj.seriesData = [
        caseEg.padnas
    ]
}
for(var i = 0; i < obj.legendData.length; i++){
    data.push(
        {
            name: obj.legendData[i],
            type:'bar',
            data: obj.seriesData[i],
            barGap: 0,
            barWidth: 20,
            itemStyle:{
                normal:{
                    barBorderRadius:[5,5,0,0],
                    label: {
                        show: true,
                        position: 'top',
                        formatter: obj.Type,
                        textStyle: {
                            color: '#cbd9fe'
                        }
                    }
                }
            }
        }
    )
};
highcaseEchart();
function highcaseEchart(){
    var option = {
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            textStyle:{
                color: '#cbd9fe'
            },
            data:obj.legendData
        },
        grid:{
            x: 30,
            y: 30,
            x2: 30,
            y2: 30,
            borderWidth: 0
        },
        calculable : false,
        xAxis : [
            {
                type : 'category',
                axisTick: {
                    show: false
                },
                splitLine:{
                    show: false,
                    color: ['#7f7c94'],
                    width: 1,
                    type: 'solid'
                },
                axisLine:{
                    lineStyle:{
                        color: '#7f7c94',
                        width: 1,
                        type: 'solid'
                    }
                },
                axisLabel:{
                    textStyle: {
                        color: '#cbd9fe'
                    }
                },
                data : caseEg.dwmc
            }
        ],
        yAxis : [
            {
                type : 'value',
                axisTick: {
                    show: false
                },
                splitLine:{
                    show: false,
                    color: ['#7f7c94'],
                    width: 1,
                    type: 'solid'
                },
                axisLine:{
                    lineStyle:{
                        color: '#7f7c94',
                        width: 1,
                        type: 'solid'
                    }
                },
                axisLabel:{
                    textStyle: {
                        color: '#cbd9fe'
                    }
                },
            }
        ],
        series : data,
        color: ['#009bfe','#33eeff','#9b70fa']
    };
    var highcaseEchart = echarts.init(document.getElementById('highcaseEchart'));
    highcaseEchart.clear();
    highcaseEchart.setOption(option);
}